import { ApiCall } from "tsrpc";
import { ReqQueryEquipListTree, ResQueryEquipListTree } from "../../shared/api_client/open/PtlQueryEquipListTree";
import { config, configKey } from "../../config";

export default async function (call: ApiCall<ReqQueryEquipListTree, ResQueryEquipListTree>) {
   
    let list = Array.from((config.get(configKey.配置_装备属性) as Map<string, any>).values())
    // 去重 不能修改原数组
    // 去重，不能修改原数组，使用新数组接收
    const uniqueList = list.filter((item, index, self) =>
        index === self.findIndex((t) => t.sys === item.sys && t.type === item.type && t.job === item.job && t.solt === item.solt)
    );
    list = uniqueList;
    call.succ({
        list: list
    });
}